<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
class MyException extends Exception {
    // 重定义构造器使 message 变为必须被指定的属性
    public $node = 'None';
    public $msg = '';
    public function __construct($message, $node = '异常Exception') {
        // 自定义的代码        
        // 确保所有变量都被正确赋值      
        parent::__construct($message);
        $this->node = $node;        
    }
    /**
     * 自定义输出错误.
     * @return type
     */
    public function errMsg($node = '') {                
        $msg = array(
            'message' => $this->message,
            'code' => $this->code,
            'file' => $this->getFile(),
            'line' => $this->getLine(),
        );
        if($node != '') {
            $this->node = $node;
        }
        mylogger($msg, $this->node);
        return $msg;
    }
}